#
# Network Caller Notification module for the Asterisk PBX
#
# Copyright (C) 2004,2005,2006 mezzoConsult C.B.
#
# Sven Slezak <sunny@mezzo.net>
#

NAME=app_notify

CC=gcc
CFLAGS=$(shell ./cflags.sh)

OSARCH=$(shell uname -s)

ifeq ($(OSARCH),Darwin)
  CFLAGS+= -D__Darwin__
  SOLINK=-dynamic -bundle -undefined suppress -force_flat_namespace
  TESTLINK=-undefined suppress -force_flat_namespace
  MODULES_DIR=/Library/Asterisk/modules
	CC=gcc -arch ppc -arch i386
else
  SOLINK=-shared -Xlinker -x
  MODULES_DIR=/usr/lib/asterisk/modules
endif

RES=$(NAME).so

app_notify.so : app_notify.o
	$(CC) $(SOLINK) -o $@ $<

all: $(RES) sampleClient

clean:
	rm -f $(NAME).o $(NAME).so notifyClient.o notifyClient sampleClient

install: all
	if [ -f $(NAME).so ]; then \
		install -m 755 $(NAME).so $(MODULES_DIR) ; \
	fi

reload: install
	asterisk -rx "unload ${RES}"
	asterisk -rx "load ${RES}"
